/*
 *    This file is part of BlobDB.
 *
 *    BlobDB is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    BlobDB is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with BlobDB.  If not, see <http://www.gnu.org/licenses/>.
 *    
 *    Copyright(c) 2011 Michael Kankkonen
 *    http://www.vnetcon.org
 */


package org.vnetcon.blobdb.database.backend.gae.jdo;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Blob;
import com.google.appengine.api.datastore.Key;

@PersistenceCapable
public class TableData {

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key tableDataKey;

    @Persistent
    private int tableDataID;
    
    @Persistent
    private int tableID;

    @Persistent
    private int rowCount;

    @Persistent
    private int freeRows;

    @Persistent
    private int lastRowid;
    
    @Persistent
    private Blob dataRows;

    @Persistent
    private long touch;
    
    public TableData(int tableDataID, int tableID){
    	this.tableDataID = tableDataID;
    	this.tableID = tableID;
    }

    public void setTableDataKey(Key tableDataKey){
    	this.tableDataKey = tableDataKey;
    }
    
	public int getTableID() {
		return tableID;
	}

	public Blob getDataRows() {
		return dataRows;
	}

	public void setDataRows(Blob dataRows) {
		this.dataRows = dataRows;
	}

	public Key getTableDataKey() {
		return tableDataKey;
	}

	public int getRowCount() {
		return rowCount;
	}

	public void setRowCount(int rowCount) {
		this.rowCount = rowCount;
	}

	public int getFreeRows() {
		return freeRows;
	}

	public void setFreeRows(int freeRows) {
		this.freeRows = freeRows;
	}

	public int getLastRowid() {
		return lastRowid;
	}

	public void setLastRowid(int lastRowid) {
		this.lastRowid = lastRowid;
	}

	public int getTableDataID() {
		return tableDataID;
	}

	public void touch(long l){
		this.touch = l;
	}
	
}
